label: Pull all pango attributes from the theme
authorTimm Bäder <mail@baedert.org>
Sun, 12 Apr 2020 07:07:57 +0000 (09:07 +0200)
committerTimm Bäder <mail@baedert.org>
Fri, 17 Apr 2020 13:21:00 +0000 (15:21 +0200)
Dont' force an underline attribute here. Just ask the theme for the
text-decoration.

gtk/gtklabel.c
gtk/theme/Adwaita/_common.scss

index 6b97b0a4f4894e2b3874aff61d5333f69b5a0db4..b960018f43d131f1ef1697f1b2fa1c31fdad4d54 100644 (file)
@@ -2988,8 +2988,6 @@ gtk_label_update_layout_attributes (GtkLabel *label)
 
   if (priv->select_info && priv->select_info->links)
     {
-      const GdkRGBA *link_color;
-      PangoAttribute *attribute;
       guint i;
 
       attrs = pango_attr_list_new ();
@@ -2997,21 +2995,36 @@ gtk_label_update_layout_attributes (GtkLabel *label)
       for (i = 0; i < priv->select_info->n_links; i++)
         {
           const GtkLabelLink *link = &priv->select_info->links[i];
-
-          attribute = pango_attr_underline_new (TRUE);
-          attribute->start_index = link->start;
-          attribute->end_index = link->end;
-          pango_attr_list_insert (attrs, attribute);
+          const GdkRGBA *link_color;
+          PangoAttrList *link_attrs;
+          PangoAttribute *attr;
+          GSList *attributes;
+          GSList *l;
 
           style = gtk_css_node_get_style (link->cssnode);
-          link_color = gtk_css_color_value_get_rgba (style->core->color);
+          link_attrs = gtk_css_style_get_pango_attributes (style);
+
+          attributes = pango_attr_list_get_attributes (link_attrs);
+          for (l = attributes; l; l = l->next)
+            {
+              attr = l->data;
 
-          attribute = pango_attr_foreground_new (link_color->red * 65535,
-                                                 link_color->green * 65535,
-                                                 link_color->blue * 65535);
-          attribute->start_index = link->start;
-          attribute->end_index = link->end;
-          pango_attr_list_insert (attrs, attribute);
+              attr->start_index = link->start;
+              attr->end_index = link->end;
+              pango_attr_list_insert (attrs, attr);
+            }
+
+          g_slist_free (attributes);
+
+          link_color = gtk_css_color_value_get_rgba (style->core->color);
+          attr = pango_attr_foreground_new (link_color->red * 65535,
+                                            link_color->green * 65535,
+                                            link_color->blue * 65535);
+          attr->start_index = link->start;
+          attr->end_index = link->end;
+          pango_attr_list_insert (attrs, attr);
+
+          pango_attr_list_unref (link_attrs);
         }
     }
   else if (priv->markup_attrs && priv->attrs)
index 7943da00b97cfa54985a90675c50fbba6ad596c8..5d2c1cdb39a571bd02daba252a2432f4cd4c85a9 100644 (file)
@@ -1050,6 +1050,7 @@ list > row button.image-button:not(.flat) {
 button:link,
 link:link {
   color: $link_color;
+  text-decoration: underline;
 
   &:visited {
     color: $link_visited_color;
@@ -1097,9 +1098,6 @@ button:visited {
 
   > label {
     @extend %link;
-
-    text-decoration-line: underline;
-
   }
 }